<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
	<title>消息管理</title>
</head>

<body>

	<div class="main-content-inner">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="${ctx}/welcome">主页</a>
				</li>
				<li class="active">消息</li>
			</ul>
		</div>	
		
		<div class="page-content">
			
			<c:if test="${not empty message}">
				<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
			</c:if>	
			
			<div class="page-header">
				<h1>
					消息
					<small>
						<i class="ace-icon fa fa-angle-double-right"></i>
						查看消息
					</small>
				</h1>
			</div>		
			
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">

							<form id="inputForm" action="${ctx}/msg/${action}" method="post" class="form-horizontal">
								<input type="hidden" name="id" id="id" value="${msg.id}"/>
								<input type="hidden" name="op" id="op" value="${action}"/>
								<input type="hidden" name="tag" id="tag" value=""/>
								<input type="hidden" name="type" id="type" value="2"/>
								
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right" for="form-field-1">创建时间: </label>
									<div class="col-sm-9">
										<input type="text" autocomplete="off" id="title" name="createdate"  value='<fmt:formatDate value="${msg.createdate}" pattern="yyyy-MM-dd HH:mm:ss" />' readonly="readonly" class="col-xs-10 col-sm-5"/>
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right" for="form-field-1">推送用户: </label>
									<div class="col-sm-2">
										<select class="chosen-select form-control" id="device" name="device" data-placeholder="">
											  <option value="1" <c:if test="${msg.device eq '1' }">selected="selected"</c:if>>Android</option>
											  <option value="2" <c:if test="${msg.device eq '2' }">selected="selected"</c:if>>IOS</option>
											  <option value="3" <c:if test="${msg.device eq '3' }">selected="selected"</c:if>>安卓IOS</option>
											  <option value="4" <c:if test="${msg.device eq '4' }">selected="selected"</c:if>>全网用户</option>
											  <option value="5" <c:if test="${msg.device eq '5' }">selected="selected"</c:if>>离线用户</option>
										</select>
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right" for="form-field-1">消息类型: </label>
									<div class="col-sm-2">
										<select class="chosen-select form-control" id="mode" name="mode" data-placeholder="" onchange="modechange();">
										    <c:choose>
											 <c:when test="${msg.category eq 1}">
											     <option value="1" <c:if test="${msg.category eq 1 }">selected="selected"</c:if>>消息推送</option>
										     </c:when>
										      <c:when test="${msg.category eq 2}">
											     <option value="2" <c:if test="${msg.category eq 2 }">selected="selected"</c:if>>消息通知</option>
										     </c:when>
										      <c:when test="${msg.category eq 3}">
											     <option value="3" <c:if test="${msg.category eq 3 }">selected="selected"</c:if>>维护通知</option>
										     </c:when>
										     <c:otherwise>
										     </c:otherwise>
										     </c:choose>
										</select>
									</div>
								</div>
								
					   
					   	        <div class="form-group">
									<label class="col-sm-3 control-label no-padding-right" for="form-field-1">通知标题: </label>
									<div class="col-sm-9">
										<input type="text" maxlength="8" autocomplete="off" id="title" name="title"  value="${msg.title}" placeholder="长度不超过8个字" class="col-xs-10 col-sm-5"/>
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right" for="form-field-1">跳转链接: </label>
									<div class="col-sm-9">
										<input type="text" autocomplete="off" id="link" name="link"  value="${msg.link}" class="col-xs-10 col-sm-5"/>
									</div>
								</div>
								
								<div class="form-group">
									<div>
									    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">内容: </label>
									    <textarea maxlength="40" class="required" rows="10"  cols="10"  id="msg" name="msg" style="height:150px; width:500px;">${msg.msg}</textarea>
									</div>
								</div>
								
								
								
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="cancel_btn" class="btn" type="reset" onclick="history.back()">
											<i class="ace-icon fa fa-undo bigger-110"></i>
											返回
										</button>
									</div>
							   </div>
								
							</form>
							
						</div>
					</div>			
				</div>
			</div>
		</div>
	</div>
	<script>
		function modechange(){
			var modeValue = $('#mode').val();
			if(modeValue=='1'){
				$('#title').attr("readonly",false); 
			}else{
				$('#title').attr("readonly",true); 
			}
		}
	</script>
</body>
</html>